package com.mycms.interceptor;

import java.util.Locale;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;

public class UserDefaultInterceptor extends HandlerInterceptorAdapter {
	Logger logger = Logger.getLogger(this.getClass());
	
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

		System.out.println("UserDefaultInterceptor.java - preHandle");
		
		
		System.out.println("UserDefaultInterceptor.java - request.getRequestURI() : " + request.getRequestURI());
		
		/* 언어 바꾸기
		HttpSession session = request.getSession();
		session.setAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME, new Locale("en", "US"));
		*/
		
		return super.preHandle(request, response, handler);
	}
}
